Feature/新增非法输入警告#409
Hidden character warning
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/input-number/FPrAgAiS3nyMyxvgJA3fUxbxYqyf |
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
==========================================
+ Coverage 97.76% 97.79% +0.02%
==========================================
Files 9 9
Lines 448 453 +5
Branches 116 117 +1
==========================================
+ Hits 438 443 +5
Misses 10 10
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
| collectInputValue(inputRef.current.value); | ||
| }; | ||
|
|
||
| const judgeData = (inputNumberValue: string) => { |
There was a problem hiding this comment.
isInvalidate的作用是判断是否为空或者判断该值是否是一个数字,isInRange的作用是判断输入值是否在区间范围内,貌似可以用这两个方法结合起来去取代judgeData;
但这两个方法是decimalValue的静态方法,在用户输入的时候,decimalValue拿不到最新的值,比如原本输入框是5,我再输入一个5,在input的onChange事件中,decimalValue的拿到的值是5而不是55,这一点你觉得有什么比较好的解决方法吗?
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| @@ -531,7 +540,7 @@ const InputNumber = React.forwardRef( | |||
| [`${prefixCls}-disabled`]: disabled, | |||
| [`${prefixCls}-readonly`]: readOnly, | |||
| [`${prefixCls}-not-a-number`]: decimalValue.isNaN(), | |||
There was a problem hiding this comment.
非数字其实应该在此处判断,更符合语义,不过这个 css 类名没写样式。需要在 assets\index.less L19 加上 &-not-a-number
|
写了个用 inputValue 的版本 |
|
@zombieJ 来 CR 一下? |
[English Template / 英文模板]
🤔 这个变动的性质是?
🔗 相关 Issue
#34987
💡 需求背景和解决方案
📝 更新日志
☑️ 请求合并前的自查清单